// composables/useTheme.js
import { useStore } from 'vuex';
import { computed } from 'vue';

// 封装获取主题色的逻辑
export const useTheme = () => {
  // const store = useStore();
  // 获取主题主色
  const themePrimary = computed(() => {
    // console.log('themePrimary', store.getters.currentTheme.primary);
    const role = uni.getStorageSync('role');
    console.log('useTheme role', role);
    if (role === 'parent') {
      return '#FFB74D'; //黄色
    } else {
      return '#0060E6'; //蓝色
    }
  });
  // 可以扩展获取其他主题变量
  const themeSecondary = computed(() => {
    const role = uni.getStorageSync('role');
    console.log('useTheme role', role);
    if (role === 'parent') {
      return '##FFF1D9'; //黄色
    } else {
      return '#CCE2FF'; //蓝色
    }
  });

  const themeTertiary = computed(() => {
    const role = uni.getStorageSync('role');
    console.log('useTheme role', role);
    if (role === 'parent') {
      return '#FFF9F0'; //黄色
    } else {
      return '#EBF3FF'; //蓝色
    }
  });
  return {
    themePrimary,
    themeSecondary,
    themeTertiary
  };
};
